package com.fjec.market.rabbitmq.provider;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class YsRegProvider {

    @Value("${fjec.market.ys.reg.exchange.name}")
    private String exchangeName;

    @Value("${fjec.market.ys.reg.router.key}")
    private String routingKey;

    @Resource(name = "ysRegAmqpTemplate")
    private RabbitTemplate ysRegAmqpTemplate;

    public void sendYsReg(Long ysRegId) {
        CorrelationData correlationData = new CorrelationData("YS_REG||" + ysRegId);
        ysRegAmqpTemplate.convertAndSend(exchangeName, routingKey, ysRegId, correlationData);
    }

}
